package com.wude.guild.holder;

import android.app.Activity;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

//import com.jjtvip.imageviewsutil.view.TCPhotoViewGroup;
import com.mc.developmentkit.utils.MCUtils;
import com.wude.bean.PinglunBean;
import com.wude.guild.R;
import com.wude.guild.imageutil.view.PhotoViewGroup;

import org.xutils.x;

import butterknife.BindView;
import butterknife.ButterKnife;
import mlxy.utils.T;

/**
 * 评论Holder
 * Created by Administrator on 2017/3/27.
 */

public class PinglunHolder extends BaseHolder<PinglunBean> {
    @BindView(R.id.icon)
    ImageView icon;
    @BindView(R.id.name)
    TextView name;
    @BindView(R.id.time)
    TextView time;
    @BindView(R.id.context)
    TextView context;
    @BindView(R.id.ll_photos)
    LinearLayout ll_photos;

    private PhotoViewGroup photoViewGroup;


    @Override
    protected void refreshView(PinglunBean pinglunBean, int position, Activity activity) {
        if (!pinglunBean.icon.equals("") && pinglunBean.icon != null) {
            MCUtils.fillImage(icon, pinglunBean.icon);
        }
        name.setText(pinglunBean.name);
        context.setText(pinglunBean.conte);
        time.setText(MCUtils.getData(pinglunBean.time, "yyyy-MM-dd HH:mm"));


        if (pinglunBean.imgurl != null && pinglunBean.imgurl.size() != 0) {
            photoViewGroup = new PhotoViewGroup(activity, pinglunBean.imgurl);
            if (ll_photos != null)
                ll_photos.removeAllViews();
            ll_photos.addView(photoViewGroup);
        }
    }

    @Override
    protected View initView() {
        View inflate = LinearLayout.inflate(x.app(), R.layout.holder_pinglun, null);
        ButterKnife.bind(this, inflate);
        inflate.setTag(this);
        return inflate;
    }
}
